<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>变量与常量</title>
</head>
<body>
    <script>
        var a = 10;
        var b = 3.14;
        var c = "hello";
        var d = '好啊';//单双引都可以
        var e = true;
        console.log(a,b,c,d,e);//可以一次性输出多个值,用逗号隔开
        //根据存的值来推断变量的类型 typeof
        console.log(typeof a,typeof b,typeof c,typeof d,typeof e);

        //js变量可以使用不同的类型
        a = 3.4;
        console.log(a,typeof a);//3.4 number
        a = false;
        console.log(a,typeof a);//boolean false
        //用var声明的变量可以重复声明
        var a = '哈哈哈我又来啦';
        console.log(a,typeof a);//哈哈哈我又来啦 string

        let x = 1;
        console.log(x,typeof x);
        x = 6.6;
        console.log(x,typeof x);
        //let x = false;//报错:x已经被声明过了
        //console.log(x,typeof x);

        const y = 1;
        console.log(y,typeof y);
        //y = 33;//常量的值不允许被修改
    </script>

</body>
</html>